<?php

class DefaultController extends CController
{
	public function actionIndex()
	{
        $this->layout = '//layouts/base';
        $model = Yii::createComponent('EntryLoginForm');
        $model->setModule($this->module);
        
		// collect user input data
		if(isset($_POST['EntryLoginForm']))
		{
			$model->attributes = $_POST['EntryLoginForm'];
			// validate user input and redirect to the previous page if valid
			if($model->validate() && $model->login())
                $this->redirect($this->module->afterEntryLoginedRedirect);
		}
        
		// display the login form
		$this->render('index',array('model'=>$model));
	}
}